package com.demo.design.stractural.composite;

public class CompositeMain {

    public static void main(String[] args) {
        TreeNode root = new BranchNode();

        TreeNode leaf1 = new LeafNode("leeeeeeeeeeeeeaf");
        TreeNode leaf2 = new LeafNode("leaf2");
        TreeNode leaf3 = new LeafNode("leaf3");
        TreeNode leaf4 = new LeafNode("leaf4");
        TreeNode branch1 = new BranchNode();
        TreeNode branch2 = new BranchNode();
        root.addNode(leaf1);
        branch2.addNode(leaf2);
        branch2.addNode(leaf3);
        branch1.addNode(branch2);
        branch1.addNode(leaf4);
        root.addNode(branch1);
        root.operate();
    }

}
